package com.example.mq.kafka.consumer;

import lombok.extern.slf4j.Slf4j;
import org.apache.kafka.clients.consumer.ConsumerRecord;
import org.springframework.kafka.annotation.KafkaListener;
import org.springframework.kafka.support.Acknowledgment;
import org.springframework.stereotype.Component;

@Slf4j
@Component
public class KafkaOrderConsumer {
    @KafkaListener(topics = "order.topic", groupId = "orderGroup")
    public void consumeOrder(ConsumerRecord<String, String> record, Acknowledgment ack) {
        log.info("消费订单消息key={},value={}", record.key(), record.value());
        ack.acknowledge();
    }
}
